package cn.big.bigd.biocode.service;

import cn.big.bigd.biocode.model.Release;
import org.hibernate.SQLQuery;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.util.*;

/**
 * Created by wangfan on 2017/12/4.
 */
@Service
public class ReleaseService {
    @PersistenceContext
    private EntityManager entityManager;

 /*   public List<Map<String, Object>> findLatestTools() {
        String sql="SELECT releases.*,tools.name FROM releases INNER JOIN tools ON tools.id=releases.tool_id ORDER BY releases.created_at DESC ";
        Query query=entityManager.createNativeQuery(sql);
        query.unwrap(SQLQuery.class).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);//设置按照数据库字段返回map 结果集

        List<Map<String, Object>> listRe= query.getResultList();
        return listRe;
    }*/
}
